doctype html
html(lang="en" ng-app="3drepo")
	head
		base(href="/")

		// Meta, title, CSS, favicons, etc.
		meta(charset='utf-8')
		meta(http-equiv='X-UA-Compatible', content='IE=edge')

		title 3D Repo - Invoice
		
		// Styling used in the Angular Material demos
		link(rel="stylesheet", href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic")

		style(type='text/css').

			html, body {
				font-family: Roboto, sans-serif;
				width: 100%;
				height: 100%;
				padding: 0;
				margin: 0;
			}

			div.container {
				width: 90%;
				padding: 5%;
				position: absolute;
			}

			p {
				margin-top: 0px;
				margin-bottom: 0px;
				padding: 0px;
				font-weight: lighter;
			}
			table {
				width: 100%;
				table-layout : fixed;
				padding-bottom: 15px;
			}
			.tableCell {
				text-align: left;
				font-weight: normal;
				padding: 0;
				padding-top: 10px;
				vertical-align: top;
			}
			.tableHead {
				font-weight: bold;
				padding-bottom: 1px;
				margin-bottom: 9px;
				border-bottom: 1px solid black; 
				border-collapse: collapse;
			}

			.productCol {
				width: 300px;
			}

			.topBlocks {
				width: 50%;
				display: inline-block;
				height: 300px;
				vertical-align: top;
			}

			#billingCompanyAddress {
				text-align: left;
			}

			#billingInvoice {
				text-align: right;
			}

			.companyTitle {
				font-weight: 500;
				font-size: 1.2em;
			}
			
			.invoice {
				margin-top: 50px;
				font-size: 40px;
			}

			#billingPeriod {
				font-size: 14px;
				font-weight: 400;
				color: #8a8a8a;
			}

			#billingInvoiceLogo {
				height: 57.5px;
			}

	body

		div.container
			div
				#billingCompanyAddress.topBlocks

					div(layout="column", class="layout-column flex-45", flex="45")
						p.companyTitle 3D Repo
						p 20 Eastbourne Terrace
						p London
						p W2 6LG
						p United Kingdom
						p VAT registration: GB 206 9090 15
						p
							| Email:
							=" "
							a(href="mailto:support@3drepo.org") support@3drepo.org

					span.flex(flex)

				#billingInvoice.topBlocks
					div
						img#billingInvoiceLogo(src=baseURL+"/images/logo.png")
					
					div.invoice
						p #{billing.pending ? 'Order confirmation': 'Invoice'}
					
					if !billing.pending
						br
						span PayPal transaction ID: #{billing.transactionId}

			table(cellspacing="0")
				tr
					th.tableCell.tableHead To
					th.tableCell.tableHead Date
					th.tableCell.tableHead Invoice Number


				tr.billingClientAddress
				
					td.tableCell 
						div 
							p #{billing.info.firstName} #{billing.info.lastName}
							if billing.info.company
								p #{billing.info.company}
							p #{billing.info.line1}

							if billing.info.line2
								p #{billing.info.line2}
							p #{billing.info.city}
							p #{billing.info.postalCode}
							p #{billing.info.countryName}
							if billing.info.vat
								p VAT ID: #{billing.info.vat}

					td.tableCell #{billing.createdAt} GMT
					td.tableCell #{billing.invoiceNo}

			table(cellspacing="0")
				tr
					th.tableCell.tableHead.productCol Product
					th.tableCell.tableHead Quantity
					th.tableCell.tableHead Unit Price
					th.tableCell.tableHead Net
					th.tableCell.tableHead VAT (%)
					th.tableCell.tableHead VAT
					th.tableCell.tableHead Total

				

				tr
					td.tableCell.productCol 
						p 
							| #{billing.items[0].description}
							if billing.proRata
								|   (pro-rata)
						p#billingPeriod (#{billing.periodStart} to #{billing.periodEnd})

					td.tableCell #{billing.items.length}
					td.tableCell £#{parseFloat(billing.unitPrice).toFixed(2)}
					td.tableCell £#{parseFloat(billing.netAmount).toFixed(2)}
					td.tableCell #{parseFloat(billing.taxPercentage).toFixed(2)}%
					td.tableCell £#{parseFloat(billing.taxAmount).toFixed(2)}
					td.tableCell £#{parseFloat(billing.amount).toFixed(2)}

			
			br

			p Your next regular monthly payment of £#{billing.nextPaymentAmount.toFixed(2)} will be billed on #{billing.nextPaymentDate}
			if billing.B2B_EU
				div
					p
						| This invoice may be subject to the
						=" "
						a(target="_blank", rel="noopener", href="http://ec.europa.eu/taxation_customs/taxation/vat/topics/invoicing_en.htm") Reverse Charge
